<template>
  <div id="app">
    <router-link replace to="/login" tag="button">登录</router-link>
    <router-link replace to="/home" tag="button">首页</router-link>
    <router-link replace to="/user" tag="button">展示用户</router-link>

    <button @click="pushShow()">push查看</button>
    <button @click="replaceShow()">replace查看</button>
    <keep-alive include="MyView,HomeIndex">
      <router-view></router-view>
    </keep-alive>
  </div>
</template>

<script>
export default {
  name: "App",
  components: {},
  methods: {
    pushShow() {
      this.$router.push({
        name: "My",
        params: {
          id: 8,
          name: "张三",
        },
      });
    },
    replaceShow() {
      this.$router.replace({
        name: "My",
        params: {
          id: 9,
          name: "小黑",
        },
      });
    },
  },
};
</script>

<style>
</style>
